home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / CHASSIS_ / TEXTGETP.C < prev    next >
Text File  |  1992-05-14  |  3KB  |  84 lines

  1. /************************************************************************************/
  2. /*    TextGetProc                                                                        */
  3. /************************************************************************************/
  4.  
  5. #include "MyHeaders.h"
  6.  
  7. int TextGetProc ()
  8. {
  9.     int            TGRetCode = 0;
  10.     
  11.     WorkRetCode = NextSubAndPosit(&nextTextPosit);    /* get a windSub and position    */
  12.     if (WorkRetCode != 0)                            /* if subscript not available    */
  13.         {        
  14.         PlaceAlert(131);                            /* load and position the alert    */
  15.         StopAlert (131, NIL);                        /* display it with stop icon    */
  16.         TGRetCode = 1;                                /* kiss it off                    */
  17.         goto ENDING;
  18.         }
  19.  
  20.     windTbl[windSub].windPtr =                            /* point to data area        */
  21.             (WindowPtr) &windTbl[windSub].windRec;
  22.     if (useColor)
  23.         windTbl[windSub].windPtr =                         /* get color template        */
  24.                 GetNewCWindow (129, windTbl[windSub].windPtr, (WindowPtr) -1);
  25.     else
  26.         windTbl[windSub].windPtr =                         /* get the template            */
  27.                 GetNewWindow (129, windTbl[windSub].windPtr, (WindowPtr) -1);
  28.     
  29.     windTbl[windSub].windRec.refCon = ProcText;            /* save window type            */
  30.     windTbl[windSub].windPathRefNum = 0;                /* clear path ref number    */
  31.     windTbl[windSub].windTEChanged = FALSE;                /* no data changed yet        */
  32.     
  33.                                                 /* position    window on desktop        */
  34.     MoveWindow (windTbl[windSub].windPtr, nextTextPosit.h, nextTextPosit.v, TRUE);
  35.  
  36.  
  37.     SetPort (&windTbl[windSub].windRec.port);    /* set this as the grafPort    */
  38.     TextFont(geneva);                                /* choose the font...        */
  39.     TextFace(NIL);                                    /* ... style, and..            */
  40.     TextSize(12);                                    /* ... size                    */
  41.  
  42.     workRect = windTbl[windSub].windRec.port.portRect;
  43.     viewRect = workRect;
  44.     viewRect.right -= 16;
  45.     viewRect.top += 4;
  46.     viewRect.bottom -= 16;
  47.     destRect = viewRect;
  48.     destRect.right -= 6;
  49.     destRect.left += 6;
  50.     windTbl[windSub].windTEH[0] =
  51.             TENew (&destRect, &viewRect);                /* create TE Record            */
  52.     SetClikLoop ((ProcPtr) myClikLoop,                    /* install click loop        */
  53.             windTbl[windSub].windTEH[0]);
  54.     TEAutoView (TRUE, windTbl[windSub].windTEH[0]);        /* enable AutoScroll        */
  55.     TESetSelect (0,0, windTbl[windSub].windTEH[0]);        /* caret to top        */
  56.     
  57.     windTbl[windSub].windTEHCount = 1;                    /* one TE field is defined    */
  58.     windTbl[windSub].windTEHSub = 0;                    /* go to first TE area        */
  59.  
  60.  
  61.  
  62.     workRect = windTbl[windSub].windRec.port.portRect;
  63.     windTbl[windSub].windCntlH[0] =                         /* get the control        */
  64.             GetNewControl (128, windTbl[windSub].windPtr);
  65.     SetCtlAction (windTbl[windSub].windCntlH[0],            /* install own action    */
  66.             (ProcPtr) myActionProc);
  67.     SizeControl (windTbl[windSub].windCntlH[0], 16,            /* size to fit window    */
  68.             workRect.bottom - workRect.top + 2 - 15);
  69.     MoveControl (windTbl[windSub].windCntlH[0],                /* move onto window        */
  70.             workRect.right - 15, workRect.top - 1);
  71.     ShowControl (windTbl[windSub].windCntlH[0]);            /* make it visible        */
  72.     
  73.     windTbl[windSub].windCntlHCount = 1;                /* one Control is defined    */
  74.     windTbl[windSub].windCntlHSub = 0;                    /* go to first Control        */
  75.  
  76.     ShowWindow (windTbl[windSub].windPtr);
  77.  
  78.     InvalRect (&windTbl[windSub].windRec.port.portRect);    /* request redraw        */
  79.  
  80.  
  81. ENDING:        
  82.     return TGRetCode;
  83. }
  84.